package com.example.controller;

import com.example.entity.RepairInfo;
import com.example.ext.entity.ExtRepairInfo;
import com.example.ext.entity.ExtSystemRole;
import com.example.service.RepairInfoService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created by youkun on 2017/10/24.
 */
@RestController
@RequestMapping("api/repairInfo")
public class RepairInfoController {

    @Autowired
    private RepairInfoService repairInfoService;

    @ApiOperation(value = "查询维修记录列表",notes = "查询维修记录列表")
    @RequestMapping(value="/queryByElevatorList",method = RequestMethod.POST)
    Map<String,Object> queryByElevatorList(@RequestBody ExtRepairInfo extRepairInfo) {

        return repairInfoService.queryByElevatorList(extRepairInfo);
    }

    @ApiOperation(value = "查询维修记录详情",notes = "查询维修记录详情")
    @RequestMapping(value="/queryByIdElevator/{id}",method = RequestMethod.POST)
    Map<String,Object> queryByIdElevator(@PathVariable String id) {

        return repairInfoService.queryByIdElevator(id);
    }

    @ApiOperation(value = "添加维修记录详情",notes = "添加维修记录详情")
    @RequestMapping(value="/addElevator",method = RequestMethod.POST)
    Map<String,Object> addElevator(@RequestBody RepairInfo repairInfo) {
        return repairInfoService.add(repairInfo);
    }

    @ApiOperation(value = "更新维修记录详情",notes = "更新维修记录详情")
    @RequestMapping(value="/update",method = RequestMethod.POST)
    Map<String,Object> update(@RequestBody RepairInfo repairInfo) {
        return repairInfoService.update(repairInfo);
    }

    @ApiOperation(value = "查询维修记录列表(使用单位)",notes = "查询维修记录列表")
    @RequestMapping(value="/queryUsedRepairList",method = RequestMethod.POST)
    Map<String,Object> queryUsedRepairList(@RequestBody Map<String, Object> extRepairInfo) {

        return repairInfoService.queryUsedRepairList(extRepairInfo);
    }

    @ApiOperation(value = "根据id查询维修详情",notes = "根据id查询维修详情")
    @RequestMapping(value="/queryRepairInfoById",method = RequestMethod.POST)
    Map<String,Object> queryRepairInfoById(@RequestBody Map<String, Object> map) {
        return repairInfoService.queryRepairInfoById(map);
    }

}
